﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Library;
using System.IO;
using System.Collections;
using System.Data.SqlClient;
namespace QuanLyThi
{
    public partial class FrmDanhMucBienSoanDeThi : Form
    {
        public static string mConnect = FrmMain.mConnect;
        private string msql = "";
        public DGC_Library mLibrary = new DGC_Library(mConnect);


        public FrmDanhMucBienSoanDeThi()
        {
            InitializeComponent();
            LoadMon();
        }
        private void LoadMon()
        {
            msql = "Select a.Mondaotao,b.Soluongcauhoi,b.diemdat,b.toida,b.thoigianlambai," +
                  "  Count(c.cauhoi)as Dasoan, case When Count(c.cauhoi)- b.Soluongcauhoi> 0" +
                  "  then N'Sẵn sàng thi' Else N'Đang biên sọan' End as Status from tb_Mondaotao a " +
                  "  inner join tb_masodethi b on a.ms_Mondaotao=b.ms_Mondaotao inner join tb_nganhangdethi c " +
                  "  on b.ms_Mondaotao=c.ms_Mondaotao where  c.cauhoiID=0 group by a.Mondaotao,b.Soluongcauhoi," +
                  "  b.diemdat,b.toida,b.thoigianlambai order by a.Mondaotao";
            DataTable dt=mLibrary.GetDataTable(msql, "a");  
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource =  dt;
            label10.Text = "Tổng số môn :" + dt.Rows.Count;
        }

        private void butthoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

       



    }
}
